<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>审核</title>
<link rel="stylesheet" href="../../layui/css/layui.css" media="all">
</head>
<body>
<script src="../../layui/layui.js"></script>
	<script src="../../res/js/base.js"></script>
	<script src="../../res/js/jquery-1.10.2.js"></script>
	<script type="text/javascript" src="../../res/mln/getUrlParam.js"></script>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
			  <legend>审核信息填写</legend>
			</fieldset>
			<form class="layui-form" id="shForm" action="../../ZgsSellOrder/SellSh.action" method="post">
			<input type="hidden" name="condition" id="condition">
			  <div class="layui-form-item">
			    <label class="layui-form-label">审核部门</label>
			    <div class="layui-input-block">
			      <input type="hidden" name="qwId" id="pwId">
			      <input type="hidden" name="auditSection" id="auditSection">
			      <input type="text" maxlength="20" lay-verify="required" autocomplete="off" class="layui-input layui-disabled" disabled style="width:280px;" id="bumen">
			    </div>
			  </div>
			  <div class="layui-form-item">
			    <label class="layui-form-label">订单名称</label>
			    <div class="layui-input-block">
			      <input type="hidden" name="isva" id="isva">
			      <input type="text" name="roleCode" maxlength="20" value="总店销售订单"  autocomplete="off" class="layui-input layui-disabled" disabled style="width:280px;">
			    </div>
			  </div>
			  <div class="layui-form-item">
			    <label class="layui-form-label">搜索选择框</label>
			      <div class="layui-input-inline">
			        <select lay-verify="required" lay-filter="isva" lay-search="" name="auditPass" id="auditPass">
			          <option value="">是否通过</option>
			          <option value="1">是</option>
			          <option value="0">否</option>
			        </select>
			      </div>
			  </div>
			  <div class="layui-form-item layui-form-text" id="auditCause">
			    <label class="layui-form-label">审核意见</label>
				    <div class="layui-input-block">
				      <textarea placeholder="请输入内容" maxlength="20" name="auditCause" class="layui-textarea" lay-verify="required" required></textarea>
				    </div>
			  </div>
			  <div class="layui-form-item">
			    <div class="layui-input-block">
			      <input type="button" class="layui-btn" lay-filter="roleAdd" value="提交" id="tj">
			    </div>
			  </div>
		 </form>
		 <script>

layui.use(['form','laydate', 'laypage', 'layer', 'table', 'upload', 'element','tree'], function(){
  var form = layui.form
  ,laydate = layui.laydate //日期
  ,laypage = layui.laypage //分页
  ,layer = layui.layer //弹层
  ,table = layui.table //表格
  ,upload = layui.upload //上传
  ,element = layui.element; //元素操作
  var path=getRootPath();
  //日期
  laydate.render({
	    elem: '#date'
  });
  laydate.render({
	    elem: '#date1'
  });
  var $ = layui.$;
  var isva = getUrlParam("isva");
  if(isva == "2"){
	  $("#bumen").val("总店财务部门");
	  $("#auditSection").val("总店财务部门");
	  $("#isva").val("6");
  }else if(isva == "3"){
	  $("#bumen").val("总店总经理");
	  $("#auditSection").val("总店总经理");
	  $("#isva").val("7");
  }
  //监听Tab切换
  element.on('tab(demo)', function(data){
    layer.msg('切换了：'+ this.innerHTML);
    console.log(data);
  });
  form.on("select(isva)",function(data){
		var qwId = $("#pwId").val();
		if(data.value == "1"){
			var url = getRootPath()+"Repertory/findByFilIdAndPwId.action";
			var data = {"qwId":qwId};
			$.ajax({
				url:url,
				data:data,
				success:function(msg){
					if(msg == "1"){
						layer.msg("您提交的订单中,有一种药品或多种药品总店的库存不足",{time:1500})
					}else if(msg == "2"){
						layer.msg("您提交的订单中,有一种药品或多种药品总店的库存不存在",{time:1500});
					}else if(msg == "3"){
						layer.msg("您提交的订单中,没有明细数据",{time:1500});
					}else if(msg == "no"){
						layer.msg("库存不存在",{time:1500});
					}else if(msg == "ok"){
						$("#tj").attr("type","submit");
						$("#tj").attr("lay-submit","");
					}
					
				}
			});
			
		}else {
			$("#tj").attr("type","submit");
			$("#tj").attr("lay-submit","");
		}
	  
  });
  form.on('submit(roleAdd)',function(){
	  parent.location.reload();
  })
  
	});
</script>
</body>
</html>